﻿using System.Data;
using System.Data.SqlClient;
using VanTaiProperty;

namespace VanTaiData
{
    public class TMServicesFOB_Controller : clsConnect
    {
        private clsConnect cls = new clsConnect();
        #region[Get-Data]
        public DataTable BindGirdTMServicesFOB()
        {
            return cls.BindGridData("sp_TMServicesFOB_Search");
        }
        public DataTable BindGirdTMServicesFOB_Detail_Edit(int id)
        {
            return cls.LayDuLieuParameter("sp_TMServicesFOB_Detail_Edit", "@ServicesFOB_ID", id);
        }
        #endregion

        #region[Insert-Update-Delete]
        public bool InsertTMServicesFOB(TMServicesFOB_Property data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@ServicesFOB_Alias", data.ServicesFOB_Alias);
            cls.AddParameter("@ServicesFOB_Name", data.ServicesFOB_Name);
            cls.AddParameter("@ServicesFOB_Price", data.ServicesFOB_Price);

            cls.AddParameter("@CarryImportPrice", data.CarryImportPrice);
            cls.AddParameter("@CarryImportPriceNight", data.CarryImportPriceNight);
            cls.AddParameter("@CarryImportPriceHoliday", data.CarryImportPriceHoliday);

            cls.AddParameter("@CarryExportPrice", data.CarryExportPrice);
            cls.AddParameter("@CarryExportPriceNight", data.CarryExportPriceNight);
            cls.AddParameter("@CarryExportPriceHoliday", data.CarryExportPriceHoliday);
            cls.AddParameter("@OtherPrice", data.OtherPrice);
            cls.ExecuteNonQuery("sp_TMServicesFOB_Insert");
            return true;
        }
        public bool UpdateTMServicesFOB(TMServicesFOB_Property data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@ServicesFOB_ID", data.ServicesFOB_ID);
            cls.AddParameter("@ServicesFOB_Alias", data.ServicesFOB_Alias);
            cls.AddParameter("@ServicesFOB_Name", data.ServicesFOB_Name);
            cls.AddParameter("@ServicesFOB_Price", data.ServicesFOB_Price);

            cls.AddParameter("@CarryImportPrice", data.CarryImportPrice);
            cls.AddParameter("@CarryImportPriceNight", data.CarryImportPriceNight);
            cls.AddParameter("@CarryImportPriceHoliday", data.CarryImportPriceHoliday);

            cls.AddParameter("@CarryExportPrice", data.CarryExportPrice);
            cls.AddParameter("@CarryExportPriceNight", data.CarryExportPriceNight);
            cls.AddParameter("@CarryExportPriceHoliday", data.CarryExportPriceHoliday);
            cls.AddParameter("@OtherPrice", data.OtherPrice);
            cls.ExecuteNonQuery("sp_TMServicesFOB_Update");
            return true;
        }
        public bool DeleteTMServicesFOB(int id)
        {
            cls.Delete("sp_TMServicesFOB_Delete", "@ServicesFOB_ID", id);
            return true;
        }
        #endregion

        #region[Search-Fillter]
        public DataTable Search(string keywords)
        {
            return cls.Search("sp_TMServicesFOB_Search", "@KEYWORDS", keywords);
        }
        #endregion
    }
}
